﻿using Entity;
using Microsoft.EntityFrameworkCore;

namespace webapi
{
    internal class MysqlDbContext : DbContext
    {
        private IConfiguration _configuration;
        public MysqlDbContext(IConfiguration configuration)
        {
            _configuration = configuration;
        }
        public DbSet<Vip>? vips { get; set; }
        public DbSet<PersonalInfo>? personalInfos { get; set; }
        public DbSet<Profession>? professions { get; set; }
        public DbSet<Contact>? contacts { get; set; }
        public DbSet<Platform>? platforms { get; set; }
        public DbSet<Skill>? skills { get; set; }
        public DbSet<Agelimit>? agelimits { get; set; }
        public DbSet<User>? users { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            var connectionString = _configuration.GetConnectionString("17bang_Vip");
            optionsBuilder
                .UseMySql(connectionString, new MySqlServerVersion(new Version(5, 7, 38)))
                ;
            base.OnConfiguring(optionsBuilder);
        }
    }
}
